package com.xxx.management.web.util;

import lombok.Data;

@Data
public class R<T> {

    private String code;
    private String message;
    private T data;

    private R(String code, String message, T data) {
        this.code = code;
        this.message = message;
        this.data = data;
    }

    /*** 成功返回 */
    public static <T> R<T> ok(T data) {
        return new R<>("200", "请求成功", data);
    }

    /*** 失败返回 */
    public static R<Void> fail(String code, String message) {
        return new R<>(code, message, null);
    }

}
